package com.example.db

import androidx.room.AutoMigration
import androidx.room.Database
import androidx.room.RoomDatabase
import com.example.db.dao.UserInfoDao
import com.example.db.entity.UserInfo
import com.example.db.migrations.UserInfoColumnName
import com.example.db.migrations.UserInfoTableName

/**
 * 自定义Room数据库
 */
@Database(
    entities = [UserInfo::class], //代表有多少张表
    version = 2,//当前数据库版本号
    exportSchema = true,//是否支持数据库协议导出,数据库升级时必须设置为true
//    autoMigrations = [
//       // AutoMigration(from = 1, to = 2, spec = UserInfoTableName::class),
//       // AutoMigration(from = 1, to = 2, spec = UserInfoColumnName::class),
//    ]//数据库升级策略
)
abstract class AppDataBase:RoomDatabase() {
    //定义获取操作Dao抽象方法
    abstract fun getUserInfoDao():UserInfoDao
}